var wsUrl = "ws://39.105.67.193:8811";
var ws  = new WebSocket(wsUrl);
ws.onopen = function(evt) {
    console.log('connected-swoole-success');
};

ws.onmessage = function(evt) {
    push(evt.data);
    console.log("Received Message: " + evt);
};

ws.onclose = function(evt) {
    console.log("Connection closed.");
};
ws.onerror = function(event) {
    console.log('error:'+event.data);
};
function push(data)
{
    data = $.parseJSON(data);
    html = '<div class="frame">';
    html += '<h3 class="frame-header">';
    html += '<i class="icon iconfont icon-shijian"></i>';
    html += data.type;
    html += '</h3>';
    html += '<div class="frame-item">';
    html += '<span class="frame-dot"></span>';
    html += '<div class="frame-item-author">';
    if(data.logo){
        html += '<img src="'+data.logo+'" width="20px" height="20px" />';
    }
    html += data.team;
    html += '</div>';
    html += '<p>'+data.content+'</p>';
    html += '</div>';
    html += '</div>';

    $('#match-result').prepend(html);
}